package com.huawei.appmarket.service.store.awk.card;

import android.content.Context;
import android.text.TextUtils.TruncateAt;
import android.view.View;
import android.view.ViewGroup.LayoutParams;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.huawei.appgallery.foundation.card.base.normal.bean.NormalCardBean;
import com.huawei.appgallery.foundation.ui.framework.cardkit.bean.CardBean;
import com.huawei.appgallery.horizontalcard.api.card.BaseHorizontalItemCard;
import o.azb;
import o.cgz;
import o.chc;
import o.chy;
import o.clp;
import o.epv;
import o.eqx;
import o.evf;
import o.evx;
import o.ewm.d;
import o.ewm.h;
import o.ewm.j;

public class HorizontalSmallEntranceItemCard extends BaseHorizontalItemCard {
    private ImageView ʼ;
    private RelativeLayout ˋ;

    public HorizontalSmallEntranceItemCard(Context context) {
        super(context);
    }

    public cgz ˏ(View view) {
        this.ˋ = (RelativeLayout) view.findViewById(j.ߴˊ);
        this.ʼ = (ImageView) view.findViewById(j.ߴˋ);
        FrameLayout frameLayout = (FrameLayout) view.findViewById(j.ٴᐝ);
        if (evf.ˊ(view)) {
            frameLayout.setVisibility(4);
        } else {
            frameLayout.setVisibility(0);
        }
        ॱ((TextView) view.findViewById(j.ۥॱ));
        ˊˋ().setSingleLine(true);
        ˊˋ().setEllipsize(TruncateAt.END);
        ʽ(view);
        ʼ();
        return this;
    }

    private int ʻ() {
        return chc.ʾ();
    }

    private void ʼ() {
        this.ˋ.setPaddingRelative(0, this.ʼॱ.getResources().getDimensionPixelSize(d.ˋ), 0, this.ʼॱ.getResources().getDimensionPixelSize(d.ॱ));
        LayoutParams layoutParams = this.ˋ.getLayoutParams();
        layoutParams.width = (azb.ॱ(this.ʼॱ) - (chc.ˋ() * (ʻ() / 2))) / ʻ();
        this.ˋ.setLayoutParams(layoutParams);
    }

    public void ˏ(CardBean cardBean) {
        super.ˏ(cardBean);
        eqx.ˊ(this.ʼ, cardBean.ॱˌ(), "circle_default_icon", eqx.d.ˋ);
    }

    public int ˊ() {
        return h.ʿᐝ;
    }

    public int ˎ() {
        return h.ʿᐝ;
    }

    public void ॱ(final chy o_chy) {
        ˉ().setOnClickListener(new evx(this) {
            final /* synthetic */ HorizontalSmallEntranceItemCard ˎ;

            public void ˋ(View view) {
                o_chy.ˏ(0, this.ˎ);
            }
        });
    }

    public void ˋ(clp<? extends NormalCardBean> o_clp__extends_com_huawei_appgallery_foundation_card_base_normal_bean_NormalCardBean) {
        super.ˋ((clp) o_clp__extends_com_huawei_appgallery_foundation_card_base_normal_bean_NormalCardBean);
        if (o_clp__extends_com_huawei_appgallery_foundation_card_base_normal_bean_NormalCardBean.ॱ() != null) {
            int size = o_clp__extends_com_huawei_appgallery_foundation_card_base_normal_bean_NormalCardBean.ॱ().size();
            if (size <= ʻ()) {
                int ˋ = chc.ˋ();
                LayoutParams layoutParams = this.ˋ.getLayoutParams();
                layoutParams.width = epv.ˎ(this.ʼॱ, size, ˋ);
                this.ˋ.setLayoutParams(layoutParams);
            }
        }
    }
}
